from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from LabsApp import settings


# 根据data生成确定token
def generate_token(data, expires=settings.VERIFY_EMAIL_TOKEN_EXPIRES):
    print(1111)
    serializer = Serializer(settings.ITSDANGEROUS_SECRET_KEY, expires_in=expires)
    token = serializer.dumps(data).decode()
    return token
